{extend name="public:base" /}
{block name="head"}
<link href="__PUBLIC__/view_res/mobile/css/uc.css" type="text/css" rel="Stylesheet" />
<link href="__PUBLIC__/view_res/mobile/css/wshop_company_center.css" type="text/css" rel="Stylesheet" />
<link href="__PUBLIC__/jquery-weui/dist/lib/weui.min.css" type="text/css" rel="Stylesheet" />
<link href="__PUBLIC__/view_res/mobile/css/login.css" type="text/css" rel="Stylesheet" />
<link href="__PUBLIC__/jquery-weui/dist/css/jquery-weui.min.css" type="text/css" rel="Stylesheet" />
<script src="__PUBLIC__/jquery-weui/dist/js/jquery-weui.min.js"></script>
<link rel="stylesheet" href="__PUBLIC__/bootstrap-3.3.7-dist/css/bootstrap.min.css">
<link href="__PUBLIC__/view_res/mobile/css/uc.css" type="text/css" rel="Stylesheet" />
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

<style>
	.uc-section span{
		text-align: center;
	}
</style>
{/block} 
{block name="header"}
{include file="public/top-nav" /}
{/block}

{block name="content"}

<div class="comspreadstat clearfix" style="position:relative">
	<span class="spread-item" style="color: #555;font-size: 16px;width: 100%;margin: 5px 0">通分数量<b>{$user_info.score|default='0'}</b></span>
	
</div>
<br>
{:token()}
{if condition="$release eq false"}
<input class="button btn-danger" id="sign_in" type="button" value="签到释放通分">
{else}
<input class="button gary" type="button" value="当日已签到">
{/if}
<br>
<header class="Thead">通分释放记录</header>

<form style="position:relative;border-bottom: 1px dashed #dedede;" action="{:url('SignIn/index')}" id="login-wrap" method="get">
	<div class="data_d">
		开始时间
		<div style="" class="data_t">
			<div class="gs-text" style="width: 100px;">
				<input type="text" name="start" id="date2" value="{if condition= '$start eq null'}{:date('Y-m-d',time())}{else}{$start}{/if}" data-options="{'type':'YYYY-MM-DD','beginYear':2010,'endYear':2088}" style="width:100px;height:19px;">
			</div>
		</div>
	</div>
	<div class="data_d">
		结束时间
		<div style="" class="data_t">
			<div class="gs-text" style="width: 100px;">
				<input type="text" name="end" id="date3" value="{if condition= '$end eq null'}{:date('Y-m-d',time())}{else}{$end}{/if}" data-options="{'type':'YYYY-MM-DD','beginYear':2010,'endYear':2088}" style="width:100px;height:19px;">
			</div>
		</div>
	</div>
	<input class="sous" type="submit" value="搜索" style="position: absolute; bottom:15%;right: 25%;width: 45px;text-align: center;height: 25px;    border-radius: 5px;color: #fff;box-shadow: 1px 1px 2px #907777; background: #b95f5f;">
</form>
<div id="ulist">
{volist name="list" id="p"}
	<section class="ulist clearfix">
		<div>
			<span class="ulist_p">{:date('Y-m-d H:i:s',$p.create_time)}</span>
			<span class="ulist_data" style="padding:0 8px;display: block;">
				释放率：{:floatval($p.rate)*100}%<br>
				释放数额：{$p.num}<br>
			</span>
		</div>
    </section>
{/volist}
</div>
<div style="text-align: right;padding:2% 3%;">
	数据总数:{$list->total()}条
	{$page}
</div>
<div id="outerdiv" style="position:fixed;top:0;left:0;background:rgba(0,0,0,0.7);z-index:2;width:100%;height:100%;display:none;">
	<div id="innerdiv" style="position:absolute;">
		<img id="bigimg" src="" />
	</div>
</div>

<script type="text/javascript">
	//图片预览
	$('#sign_in').click(function(){

		var token = $('input[name="__token__"]').val();

		$.ajax({
			url : "{:url('SignIn/sign_in')}",
			data : {token:token},
			type : 'post',
			success:function(d){
				if(d.error){
					$.toast(d.error, "forbidden");
				}else if(d.success){
					var _this = $(this);							//将当前的pimg元素作为_this传入函数
					imgShow("#outerdiv", "#innerdiv", "#bigimg", _this);
					setTimeout(function (){
						window.location.href = "/mobile/SignIn/index";
					},1000);
				}
			}
		});

	});
	function imgShow(outerdiv, innerdiv, bigimg, _this) {
		var src = '/public/uploads/images/osc1/yaoqianshu.gif';					//获取当前点击的pimg元素中的src属性
		$(bigimg).attr("src", src);						//设置#bigimg元素的src属性

		//获取当前点击图片的真实大小，并显示弹出层及大图
		$("<img/>").attr("src", src).load(function () {
			var windowW = $(window).width();			//获取当前窗口宽度
			var windowH = $(window).height();			//获取当前窗口高度
			var realWidth = this.width;					//获取图片真实宽度
			var realHeight = this.height;				//获取图片真实高度
			var imgWidth, imgHeight;
			var scale = 1;							//缩放尺寸，当图片真实宽度和高度大于窗口宽度和高度时进行缩放

			if (realHeight > windowH * scale) {			//判断图片高度
				imgHeight = windowH * scale;			//如大于窗口高度，图片高度进行缩放
				imgWidth = imgHeight / realHeight * realWidth;		//等比例缩放宽度
				if (imgWidth > windowW * scale) {					//如宽度扔大于窗口宽度
					imgWidth = windowW * scale;						//再对宽度进行缩放
				}
			} else if (realWidth > windowW * scale) {				//如图片高度合适，判断图片宽度
				imgWidth = windowW * scale;							//如大于窗口宽度，图片宽度进行缩放
				imgHeight = imgWidth / realWidth * realHeight;		//等比例缩放高度
			} else {									//如果图片真实高度和宽度都符合要求，高宽不变
				imgWidth = realWidth;
				imgHeight = realHeight;
			}
			$(bigimg).css("width", imgWidth);			//以最终的宽度对图片缩放

			var w = (windowW - imgWidth) / 2;			//计算图片与窗口左边距
			var h = (windowH - imgHeight) / 2.5;			//计算图片与窗口上边距
			$(innerdiv).css({"top": h, "left": w});		//设置#innerdiv的top和left属性
			$(outerdiv).fadeIn("fast");					//淡入显示#outerdiv及.pimg
		});
		$('#outerdiv').click(function () {				//再次点击淡出消失弹出层
			$(this).fadeOut("fast");
		});

		setTimeout(function (){
			$(this).fadeOut("fast");
		},200);


	}
</script>

{/block}

